layui.define
(['table', 'YsModal'], function (exports) {
	/* 定义object对象【start】 */
	var object = {
		init:function (c) {this.f(c);this.load();return object;},
		c: {data:[]}, // 配置项
		f: function (c) { // 数据初始化
			var s = new Date().getTime(),t = this;
			/* YsSubGridBtn基本配置，格式：
			{
				'gridId': 123,
				'id_table_sub_grid': 'xxxxx',
				'subGridObj': obj
			}
			 */
			t.c = c;
		},
		load:function () { // 加载控件
			this.listenBtn();
		},
		listenBtn:function () { // 添加监听
			var t = this;
			// 工具栏事件
			layui.table.on('toolbar(' + t.c.id_table_sub_grid + ')', function(obj){
				var id = obj.config.id;
				var checkStatus = layui.table.checkStatus(t.c.id_table_sub_grid);
				var checkedDatas = checkStatus.data;
				var othis = lay(this);

				if(t.c.gridId == 3) { // 按钮监听-【物料出库明细】
					t.listenGrid3(obj, checkedDatas);
				}else if(t.c.gridId == 4) { // 按钮监听-【员工工资申请表】
					t.listenGrid4(obj, checkedDatas);
				}else if(t.c.gridId == 6) { // 按钮监听-【工资付款单】
					t.listenGrid6(obj, checkedDatas);
				}else if(t.c.gridId == 7) { // 按钮监听-【物料借用单】
					t.listenGrid7(obj, checkedDatas);
				}else if(t.c.gridId == 8) { // 按钮监听-【物料转移单明细】
					t.listenGrid8(obj, checkedDatas);
				}else if(t.c.gridId == 9) { // 按钮监听-【员工月度绩效申报】
					t.listenGrid9(obj, checkedDatas);
				}else if(t.c.gridId == 10) { // 按钮监听-【物料入库明细】
					t.listenGrid10(obj, checkedDatas);
				}else if(t.c.gridId == 11) { // 按钮监听-【医保付款子表】
					t.listenGrid11(obj, checkedDatas);
				}else if(t.c.gridId == 12) { // 按钮监听-【社保付款单】
					t.listenGrid12(obj, checkedDatas);
				}else if(t.c.gridId == 13) { // 按钮监听-【公积金付款单】
					t.listenGrid13(obj, checkedDatas);
				}else if(t.c.gridId == 14) { // 按钮监听-【个税付款单】
					t.listenGrid14(obj, checkedDatas);
				}else if(t.c.gridId == 15) { // 按钮监听-【预支台账明细】
					t.listenGrid15(obj, checkedDatas);
				}else if(t.c.gridId == 17) { // 按钮监听-【预支账户报销单列表】
					t.listenGrid17(obj, checkedDatas);
				}else if(t.c.gridId == 18) { // 按钮监听-【应付账户台账明细】
					t.listenGrid18(obj, checkedDatas);
				}else if(t.c.gridId == 19) { // 按钮监听-【应付账户支付】
					t.listenGrid19(obj, checkedDatas);
				}else if(t.c.gridId == 20) { // 按钮监听-【预约调拨详情】
					t.listenGrid20(obj, checkedDatas);
				}else if(t.c.gridId == 21) { // 按钮监听-【资金登记单】
					t.listenGrid21(obj, checkedDatas);
				}else if(t.c.gridId == 22) { // 按钮监听-【透明计划申报】
					t.listenGrid22(obj, checkedDatas);
				}else if(t.c.gridId == 23) { // 按钮监听-【预付款认领单】
					t.listenGrid23(obj, checkedDatas);
				}else if(t.c.gridId == 24) { // 按钮监听-【亚马逊店铺管理】
					t.listenGrid24(obj, checkedDatas);
				}else if(t.c.gridId == 25) { // 按钮监听-【资金认领单】
					t.listenGrid25(obj, checkedDatas);
				}else if(t.c.gridId == 26) { // 按钮监听-【万里汇货币兑换子表】
					t.listenGrid26(obj, checkedDatas);
				}else if(t.c.gridId == 27) { // 按钮监听-【VAT申报】
					t.listenGrid27(obj, checkedDatas);
				}else if(t.c.gridId == 28) { // 按钮监听-【万里汇提款单子表】
					t.listenGrid28(obj, checkedDatas);
				}else if(t.c.gridId == 29) { // 按钮监听-【预付款退回申请单子表】
					t.listenGrid29(obj, checkedDatas);
				}else if(t.c.gridId == 30) { // 按钮监听-【万里汇CNY付款单】
					t.listenGrid30(obj, checkedDatas);
				}else if(t.c.gridId == 31) { // 按钮监听-【万里汇预付款退回子表】
						t.listenGrid31(obj, checkedDatas);
				}else if(t.c.gridId == 32) { // 按钮监听-【VAT申报详情】
					t.listenGrid32(obj, checkedDatas);
				}else if(t.c.gridId == 33) { // 按钮监听-【万里汇补账单】
					t.listenGrid33(obj, checkedDatas);
				}else if(t.c.gridId == 34) { // 按钮监听-【万里汇预付款入账单】
					t.listenGrid34(obj, checkedDatas);
				}else if(t.c.gridId == 35) { // 按钮监听-【万里汇外币付款单】
					t.listenGrid35(obj, checkedDatas);
				}else if(t.c.gridId == 36) { // 按钮监听-【万里汇预付款对账单】
					t.listenGrid36(obj, checkedDatas);
				}else if(t.c.gridId == 37) { // 按钮监听-【财务工资小计部门维护】
					t.listenGrid37(obj, checkedDatas);
				}else if(t.c.gridId == 38) { // 按钮监听-【预约调拨取消单】
					t.listenGrid38(obj, checkedDatas);
				}else if(t.c.gridId == 39) { // 按钮监听-【手工分配单】
					t.listenGrid39(obj, checkedDatas);
				}else if(t.c.gridId == 40) { // 按钮监听-【员工档案表】
					t.listenGrid40(obj, checkedDatas);
				}else if(t.c.gridId == 41) { // 按钮监听-【职能费用申请】
					t.listenGrid41(obj, checkedDatas);
				}else if(t.c.gridId == 42) { // 按钮监听-【付款申请单】
					t.listenGrid42(obj, checkedDatas);
				}else if(t.c.gridId == 43) { // 按钮监听-【财务交易类型子表】
					t.listenGrid43(obj, checkedDatas);
				}else if(t.c.gridId == 44) { // 按钮监听-【费用结算返还单】
					t.listenGrid44(obj, checkedDatas);
				}else if(t.c.gridId == 45) { // 按钮监听-【费用划拨单】
					t.listenGrid45(obj, checkedDatas);
				}else if(t.c.gridId == 46) { // 按钮监听-【费用结算单】
					t.listenGrid46(obj, checkedDatas);
				}else if(t.c.gridId == 47) { // 按钮监听-【采购合同单】
					t.listenGrid47(obj, checkedDatas);
				}else if(t.c.gridId == 49) { // 按钮监听-【采购预入库明细】
					t.listenGrid49(obj, checkedDatas);
				}else if(t.c.gridId == 51) { // 按钮监听-【预约采购单子件】
					t.listenGrid51(obj, checkedDatas);
				}else if(t.c.gridId == 52) { // 按钮监听-【发票预核销单子表】
					t.listenGrid52(obj, checkedDatas);
				}else if(t.c.gridId == 53) { // 按钮监听-【采购付款单单子表】
					t.listenGrid53(obj, checkedDatas);
				}else if(t.c.gridId == 56) { // 按钮监听-【Listing库子件】
					t.listenGrid56(obj, checkedDatas);
				}else if(t.c.gridId == 58) { // 按钮监听-【报关单子表】
					t.listenGrid58(obj, checkedDatas);
				}else if(t.c.gridId == 61) { // 按钮监听-【Listing库网店子表】
					t.listenGrid61(obj, checkedDatas);
				}else if(t.c.gridId == 62) { // 按钮监听-【公司账户资金转账子表】
					t.listenGrid62(obj, checkedDatas);
				}else if(t.c.gridId == 63) { // 按钮监听-【采购计划】
					t.listenGrid63(obj, checkedDatas);
				}else if(t.c.gridId == 68) { // 按钮监听-【线上质检上架】
					t.listenGrid68(obj, checkedDatas);
				}else if(t.c.gridId == 70) { // 按钮监听-【线上采购退货单】
					t.listenGrid70(obj, checkedDatas);
				}else if(t.c.gridId == 71) { // 按钮监听-【手工组装单】
					t.listenGrid71(obj, checkedDatas);
				}else if(t.c.gridId == 72) { // 按钮监听-【手工拆装单】
					t.listenGrid72(obj, checkedDatas);
				}else if(t.c.gridId == 73) { // 按钮监听-【线上采购退货单审批】
					t.listenGrid70(obj, checkedDatas);
				}else if(t.c.gridId == 74) { // 按钮监听-【库存调拨单】
					t.listenGrid74(obj, checkedDatas);
				}else if(t.c.gridId == 75) { // 按钮监听-【货位转移单】
					t.listenGrid75(obj, checkedDatas);
				}else if(t.c.gridId == 65) { // 按钮监听-【入账申请单子表】
					t.listenGrid65(obj, checkedDatas);
				}else if(t.c.gridId == 66) { // 按钮监听-【费用划拨管理单】
					t.listenGrid66(obj, checkedDatas);
				}else if(t.c.gridId == 67) { // 按钮监听-【预约调拨发布单】
					t.listenGrid67(obj, checkedDatas);
				}else if(t.c.gridId == 76) { // 按钮监听-【库存出库子件】
					t.listenGrid76(obj, checkedDatas);
				}else if(t.c.gridId == 77) { // 按钮监听-【库存入库子件】
					t.listenGrid77(obj, checkedDatas);
				}else if(t.c.gridId == 80) { // 按钮监听-【HW商品选品库子件】
					t.listenGrid80(obj, checkedDatas);
				}else if(t.c.gridId == 81) { // 按钮监听-【HW采购计划子件】
					t.listenGrid81(obj, checkedDatas);
				}else if(t.c.gridId == 78) { // 按钮监听-【FBA计划单子件】
					t.listenGrid78(obj, checkedDatas);
				}else if(t.c.gridId == 82) { // 按钮监听-【预估费用详情】
					t.listenGrid82(obj, checkedDatas);
				}else if(t.c.gridId == 85) { // 按钮监听-【运输类型维护详情】
					t.listenGrid85(obj, checkedDatas);
				}else if(t.c.gridId == 89) { // 按钮监听-【物流付款单（关税费）】
					t.listenGrid89(obj, checkedDatas);
				}else if(t.c.gridId == 90) { // 按钮监听-【物流付款单（关税费）】
					t.listenGrid90(obj, checkedDatas);
				}else if(t.c.gridId == 91) { // 按钮监听-【物流服务商子表】
					t.listenGrid91(obj, checkedDatas);
				}else if(t.c.gridId == 93) { // 按钮监听-【C88文件管理】
					t.listenGrid93(obj, checkedDatas);
				}
			});
	    },
	    listenGrid3: function(obj, checkedDatas) {
	    	var t = this;
			switch(obj.event){
				case 'event-to-select-stock': // 选取物料库存
				{
					var selectedDatas = [];
					var gridDatas = t.c.subGridObj.getData();
					console.log(gridDatas);
					layui.YsModal.init({modalKey: 'TWL_Stock', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: []});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
	    },
		listenGrid4: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增员工工资条
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row.realityPaySlip = gridDatas[i].realityPaySlip;
						row.needPaySlip = gridDatas[i].needPaySlip;
						row.wagesPay = gridDatas[i].wagesPay;
						row.rank = gridDatas[i].rank;
						row.orgName = gridDatas[i].orgName;
						row.pointMonth = gridDatas[i].pointMonth;
						row.userPaySlipidid = gridDatas[i].userPaySlipidid;
						row.id = gridDatas[i].userPaySlipidid;
						row.orgNamePointMonth = gridDatas[i].orgNamePointMonth;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TB_UserPaySlipAp', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: 'orgNamePointMonth'});
					break;
				}
				case 'event-to-delete': // 删除员工工资条
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid6: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增工资付款单
				{
					layui.YsModal.init({modalKey: 'TB_UserPayApplyGz', uniqueKey: 'id', parentObj: t.c.subGridObj});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid7: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					layui.YsModal.init({modalKey: 'TWL_Stock_For_Borrow', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: 'orgName'});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
	    listenGrid8: function(obj, checkedDatas) {
	    	var t = this;
			switch(obj.event){
				case 'event-to-select-stock': // 选取物料库存
				{
					var selectedDatas = [];
					var gridDatas = t.c.subGridObj.getData();
					console.log(gridDatas);
					layui.YsModal.init({modalKey: 'TWL_Stock', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: []});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
	    },
		listenGrid9: function(obj, checkedDatas) {//员工月度绩效申报
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					var gridDatas = t.c.subGridObj.getData();
					console.log(gridDatas);
					layui.YsModal.init({modalKey: 'TB_UserMonthPerformance', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: []});
					//layui.YsModal.init({modalKey: 'TWL_Stock', type: 'checkbox', uniqueKey: 'code', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: []});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
	    listenGrid10: function(obj, checkedDatas) {
	    	var t = this;
			switch(obj.event){
				case 'event-to-select': // 选取物料
				{
					var selectedDatas = [];
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({modalKey: 'TB_Material', type: 'checkbox', uniqueKey: 'code', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: []});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
	    },
		listenGrid11: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增医保付款单
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row.userMonthPerformanceId = gridDatas[i].userMonthPerformanceId;
						row.type = gridDatas[i].type;
						row.rank = gridDatas[i].rank;
						row.orgName = gridDatas[i].orgName;
						row.deptName = gridDatas[i].deptName;
						row.userState = gridDatas[i].userState;
						row.userName = gridDatas[i].userName;
						row.pointMonth = gridDatas[i].pointMonth;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TB_UserMonthPerformanceYb', type: 'checkbox', uniqueKey: 'userMonthPerformanceId', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [],sameCode: 'orgName'});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();

					//计算逻辑
					var healthCompany = 0;
					var healthPersonal = 0;
					var birthCompany = 0;
					var orgName = "";
					for (let n = 0; n < t.c.subGridObj.c.sonlist.length; n++) {
						orgName = t.c.subGridObj.c.sonlist[n].orgName
						healthCompany = healthCompany + Number(t.c.subGridObj.c.sonlist[n].healthCompany)
						healthPersonal = healthPersonal + Number(t.c.subGridObj.c.sonlist[n].healthPersonal)
						birthCompany = birthCompany + Number(t.c.subGridObj.c.sonlist[n].birthCompany)
					}
					window.formObj.setValueByName("orgName",orgName);
					window.formObj.setValueByName("healthCompany",healthCompany);
					window.formObj.setValueByName("healthPersonal",healthPersonal);
					window.formObj.setValueByName("healthTol",healthCompany+healthPersonal);
					break;
				}
			};
		},
		listenGrid12: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增社保付款单
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row.userMonthPerformanceId = gridDatas[i].userMonthPerformanceId;
						row.type = gridDatas[i].type;
						row.rank = gridDatas[i].rank;
						row.orgName = gridDatas[i].orgName;
						row.deptName = gridDatas[i].deptName;
						row.userState = gridDatas[i].userState;
						row.userName = gridDatas[i].userName;
						row.pointMonth = gridDatas[i].pointMonth;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TB_UserMonthPerformanceSb', type: 'checkbox', uniqueKey: 'userMonthPerformanceId', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [],sameCode: 'orgName'});
					break;
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();

					//计算逻辑
					var societyCompany = 0;
					var societyPersonal = 0;
					var orgName = "";
					for (let n = 0; n < t.c.subGridObj.c.sonlist.length; n++) {
						orgName = t.c.subGridObj.c.sonlist[n].orgName
						societyCompany = societyCompany + Number(t.c.subGridObj.c.sonlist[n].retirementCompany)+ Number(t.c.subGridObj.c.sonlist[n].loseWorkCompany)+ Number(t.c.subGridObj.c.sonlist[n].injuryCompany)
						societyPersonal = societyPersonal + Number(t.c.subGridObj.c.sonlist[n].retirementPersonal)+ Number(t.c.subGridObj.c.sonlist[n].loseWorkPersonal)
					}
					window.formObj.setValueByName("orgName",orgName);
					window.formObj.setValueByName("healthCompany",societyCompany);
					window.formObj.setValueByName("healthPersonal",societyPersonal);
					window.formObj.setValueByName("societyTol",societyCompany+societyPersonal);
					break;
				}
			};
		},
		listenGrid13: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增公积金付款单
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row.userMonthPerformanceId = gridDatas[i].userMonthPerformanceId;
						row.type = gridDatas[i].type;
						row.rank = gridDatas[i].rank;
						row.orgName = gridDatas[i].orgName;
						row.deptName = gridDatas[i].deptName;
						row.userState = gridDatas[i].userState;
						row.userName = gridDatas[i].userName;
						row.pointMonth = gridDatas[i].pointMonth;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TB_UserMonthPerformanceGjj', type: 'checkbox', uniqueKey: 'userMonthPerformanceId', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [],sameCode: 'orgName'});
					break;
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();

					//计算逻辑
					var accumulationFundCompany = 0;
					var accumulationFundPersonal = 0;
					var orgName = "";
					for (let n = 0; n < t.c.subGridObj.c.sonlist.length; n++) {
						orgName = t.c.subGridObj.c.sonlist[n].orgName
						accumulationFundCompany = accumulationFundCompany + Number(t.c.subGridObj.c.sonlist[n].accumulationFundCompany)
						accumulationFundPersonal = accumulationFundPersonal + Number(t.c.subGridObj.c.sonlist[n].accumulationFundPersonal)
					}
					window.formObj.setValueByName("orgName",orgName);
					window.formObj.setValueByName("accumulationFundCompany",accumulationFundCompany);
					window.formObj.setValueByName("accumulationFundPersonal",accumulationFundPersonal);
					window.formObj.setValueByName("accumulationTol",accumulationFundCompany+accumulationFundPersonal);
					break;
				}
			};
		},
		listenGrid14: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增个税付款单
				{
					layui.YsModal.init({modalKey: 'TB_UserPayApplyGs', uniqueKey: 'id', parentObj: t.c.subGridObj});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid15: function(obj, checkedDatas) {//预支台账明细
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增预支台账明细
				{
					var id = window.formObj.getValueByName("id");
					var code = window.formObj.getValueByName("code");
					var name = window.formObj.getValueByName("name");
					if(code==undefined || code==null || code==''){
						layer.msg("请先选择预支账户编码!");
						return;
					}
					t.c.subGridObj.c.sonlist.push({
						id: null,
						pid:id,
						pCode: code,
						pName: name,
						createTime: '',
						companyName:'',
						companyInfoId : '',
						advanceTypeCode : '',
						advanceTypeName : '',
						vjylx : '',
						detailName : '',
						unitPrice : 0,
						quantity : 0,
						proxyPrice : 0,
						totalPrice : 0,
						proxyTotalPrice : 0,
						vgsbm : '',
						vgsjc : '',
						remark : '',
						annexFile : '0个附件',
						detailType : 0,
						transferStatus : 0,
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
			};
		},

		listenGrid17: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var code = window.formObj.getValueByName("code");
					var advanceAccountId = window.formObj.getValueByName("advanceAccountId");//预支账户管理表id
					if(code==undefined || code==null || code==''){
						layer.msg("请先选择预支账户编码!");
						return;
					}
					var companyVid = window.formObj.getValueByName("companyVid");//所属公司编码
					if(companyVid==undefined || companyVid==null || companyVid==''){
						layer.msg("请先选择所属公司!");
						return;
					}
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					console.log('gridDatas',gridDatas);
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						selectedDatas.push(row);
					}
					console.log("advanceAccountId::"+advanceAccountId);
					layui.YsModal.init({modalKey: 'TCW_AdvanceAccountDetail', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [{code: 'pid', value: advanceAccountId},{code: 'companyInfoVid', value: companyVid}]});
					//layui.YsModal.init({modalKey: 'TCW_AdvanceAccountDetail', uniqueKey: 'id', parentObj: t.c.subGridObj});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();

					//计算本次报销金额
					var totalPriceByThis = 0;
					if(t.c.subGridObj.c.sonlist!=null && t.c.subGridObj.c.sonlist.length>0){
						for(var i=0;i<t.c.subGridObj.c.sonlist.length;i++){
							var totalPriceByItem = parseFloat(t.c.subGridObj.c.sonlist[i].totalPrice);
							if(totalPriceByItem){
								totalPriceByThis = totalPriceByThis+totalPriceByItem;
							}
						}
					}
					window.formObj.setValueByName("totalPriceByThis",totalPriceByThis);
					break;
				}

				case 'event-to-export': // 导出
				{
					$.ajax({
						type: "POST",
						url: '/api/inter/tcwAdvanceAccountReimbursement/exportByItem',
						data: {bid:window.formObj.getValueByName("bid")},
						success: function (data) {
							if (data.code == 0) {
								if(data.msg != undefined && data.msg.startsWith('http')) {
									window.open(data.msg);
								} else {
									layer.msg(data.msg);
								}
							} else {
								alert(data.msg);
							}
						}
					});

					break;
				}

			};
		},

		listenGrid18: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增应付台账明细
				{
					t.c.subGridObj.c.sonlist.push({state : 0,transferStatus : 0});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid19: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var needPayAccountCode = window.formObj.getValueByName("needPayAccountCode");//应付账户编码
					if(needPayAccountCode==undefined || needPayAccountCode==null || needPayAccountCode==''){
						layer.msg("请先选择应付账户!");
						return;
					}
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row.id = gridDatas[i].needPayLedgerDetailId;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCW_NeedPayLedgerDetail', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [{code: 'needPayAccountCode', value: needPayAccountCode}]});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid20: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-select': // 选取Listing普品
				{
					t.c.subGridObj.c.sonlist.push({state : 1});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid21: function(obj, checkedDatas) {//资金登记单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
                    var selectedDatas = [];
                    //回填数据的代码
                    var gridDatas = t.c.subGridObj.getData();
                    for (var i = 0; i < gridDatas.length; i++) {
                        var row = {};
                        row = gridDatas[i];
						//row.id = gridDatas[i].operateCompanyBankInfoId;
                        selectedDatas.push(row);
                    }
					layui.YsModal.init({modalKey: 'THR_OperateCompanyBankInfo', type: 'checkbox', uniqueKey: 'vid', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid22: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						annexFile : '0个附件',
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid23: function(obj, checkedDatas) {//预付款认领单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'THR_OperateCompanyBankInfo', type: 'checkbox', uniqueKey: 'vid', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid24: function(obj, checkedDatas) {//新增亚马逊店铺
			var t = this;
			switch(obj.event){
				case 'event-to-select': // 新增
				{
					var selectedDatas = [];
					debugger
					var gridDatas = t.c.subGridObj.getData();
					var _list = [];
					for (var i = 0; i < gridDatas.length; i++) {
						if(gridDatas[i].siteId!=undefined && gridDatas[i].siteId!=null && gridDatas[i].siteId!=''){
							_list.push(gridDatas[i].siteId);
						}
					}

					var tbSiteData = [];
					if(_list!=null && _list.length>0) {
						$.ajax({
							url: '/api/inter/tbSite/tbSiteList',
							data: "list=" + _list,
							type: 'POST',
							async: true,
							success: function (res) {
								tbSiteData = res.data
								//回填数据的代码
								for (var i = 0; i < tbSiteData.length; i++) {
									var row = {};
									row = tbSiteData[i];
									selectedDatas.push(row);
								}
								layui.YsModal.init({modalKey: 'TB_Site', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
							}, error: function () {
								layer.closeAll();
								layer.msg("获取站点信息失败！", {icon: 2});
							}
						});
					}else {
						layui.YsModal.init({modalKey: 'TB_Site', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					}
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid25: function(obj, checkedDatas) {//资金认领单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'THR_OperateCompanyBankInfo', type: 'checkbox', uniqueKey: 'vid', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-del': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tcwCapitalClaim/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.closeAll();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.closeAll();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},
		listenGrid26: function(obj, checkedDatas) {//万里汇货币兑换子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						hcAmount : '0',
						hrAmount : '0',
						exchangeRate : '0',
						hcCurrency : 'CNH',
						hrCurrency : 'CNH',
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid27: function(obj, checkedDatas) {// VAT申报明细
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'THR_OperateCompanyEuropeTrade', type: 'checkbox', uniqueKey: 'vatNo', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid28: function(obj, checkedDatas) {//万里汇提款单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TB_CompanyBankInfo', type: 'checkbox', uniqueKey: 'vid', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid29: function(obj, checkedDatas) {//预付款退回申请子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					if (t.c.subGridObj.c.sonlist.length != 0){return layer.msg("预付款退回申请子表只允许新增一条,核实后再操作!");}
					t.c.subGridObj.c.sonlist.push({
						id: null,
						vJyLx : '运营服务→预付款退回',
						accountType : 0,
						thAmount : 0,
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					var newOptions = [
						{name: "店铺回款", value: "0"},
						{name: "对公打款", value: "1"},
						{name: "空", value: "2"},
					];

					var paymentReturnType = 2;

					// 清空原有选项
					$('#paymentReturnType').empty();

					// 添加新的选项
					for (var i = 0; i < newOptions.length; i++) {
						if (i == Number(paymentReturnType)) {
							$('#paymentReturnType').append('<option selected value="' + newOptions[i].value + '">' + newOptions[i].name + '</option>');
						} else {
							$('#paymentReturnType').append('<option value="' + newOptions[i].value + '">' + newOptions[i].name + '</option>');
						}
					}

					// 更新select元素
					layui.form.render('select');
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid30: function(obj, checkedDatas) {// 万里汇CNY付款单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						row.vid = row.partnerBankInfoVid;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCW_PartnerBankInfo', type: 'checkbox', uniqueKey: 'vid', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid31: function(obj, checkedDatas) {//万里汇预付款退回子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						row.bid = gridDatas[i].paymentReturnBid;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCW_PaymentReturnWl', type: 'checkbox', uniqueKey: 'paymentReturnItemId', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						layer.confirm('确定要删除吗？', {icon: 3}, function () {
							// var flax = false;
							// for (var i = 0; i < datas.length; i++) {
							// 	if(datas[i].statePay === 1 || datas[i].statePay === 2){
							// 		flax = true;
							// 		return layer.msg('选中数据不允许删除,请核实后再操作!')
							// 	}
							// }
							t.c.subGridObj.removeRowsChecked();
							layer.closeAll();
						})
					}
					break;
				}
				case 'event-to-tzWanli': // 跳转万里汇
				{
					window.open('https://portal.worldfirst.com.cn/login?loginType=EMAIL&region=CN', '_blank');
					break;
				}
				case 'event-to-zrWanli': // 转入万里汇
				{
					var t = this;
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var checkedDatas = checkStatus.data;
					if (checkedDatas.length == 0){
						return layer.msg("至少选择一条数据,请核实后在操作！");
					}else if (checkedDatas.length > 1){
						return layer.msg("只允许选择一条数据,请核实后在操作！");
					}
					for (var i = checkedDatas.length - 1; i >= 0; i--) {
						var id = checkedDatas[i]['id'];
					}
					var index= layer.msg('转入万里汇中,请勿重复操作!', { icon: 16, shade: 0.01 , time: false});
					$.ajax({
						async: true,
						type: "GET",
						url: '/api/inter/tcwWanliPaymentReturn/zrWanli',
						data: {id: id},
						success: function (data) {
							if (data.code == 0) {
								layer.close(index);
								layer.msg(data.msg);
								location.reload();
							} else {
								layer.close(index);
								alert(data.msg);
								location.reload();
							}
						}
					});
					break;
				}
			};
		},
		listenGrid32: function(obj, checkedDatas) {// VAT申请
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var domForm = $('#' + window.formObj.c.id_form);
					var vgsbm = domForm.find('input[name="vgsbm"]').val();
					var countryCode = domForm.find('input[name="countryCode"]').val();
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						row.id = row.cbbId;
						row.declareStateName = row.declareStateName;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCC_LogisticsSadFileVat', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''
						, pathGridRequest: '/api/inter/tccLogisticsSadFile/searchForModal?vgsbm='+vgsbm + "&countryCode=" + countryCode
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid33: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					layui.YsModal.init({modalKey: 'TCW_DepositPlatform', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: 'orgName'});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
        listenGrid34: function(obj, checkedDatas) {//万里汇预付款入账单
            var t = this;
            switch(obj.event){
                case 'event-to-add': // 新增
                {
                    var domForm = $('#' + window.formObj.c.id_form);
                    var reconciliationBid = domForm.find('input[name="reconciliationBid"]').val();
                    if(reconciliationBid==undefined || reconciliationBid==null || reconciliationBid==''){
                        return layer.msg("请先选择对账单号！");
                    }
                    var selectedDatas = [];
                    //回填数据的代码
                    var gridDatas = t.c.subGridObj.getData();
                    for (var i = 0; i < gridDatas.length; i++) {
                        var row = {};
                        row = gridDatas[i];
                        selectedDatas.push(row);
                    }
                    layui.YsModal.init({modalKey: 'TCW_WanliReconciliationItem_ByRecorded', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [{code: 'pbid', value: reconciliationBid}]});
                    break;
                }
                case 'event-to-del': // 删除
                {
                    var t1 = t.c.subGridObj;
                    var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
                    var datas = checkStatus.data;
                    if (datas.length == 0) {
                        layer.alert('尚未选中数据');
                    } else {
                        var _list = [];
                        //console.log('datas',datas);
                        for (var i = 0; i < datas.length; i++) {
                            if(datas[i].itemId!=undefined && datas[i].itemId!=null && datas[i].itemId!=''){
                                _list.push(datas[i].itemId);
                            }
                        }
                        layer.confirm('确定要删除吗？', { icon: 3 }, function() {
                            //console.log('_list',_list);
                            if(_list!=null && _list.length>0){
                                layer.msg('处理中', { icon: 16, shade: 0.01 });
                                $.ajax({
                                    url: '/api/inter/tcwWanliPrepaymentRecorded/toDelByItem',
                                    data: "list=" + _list,
                                    type: 'POST',
                                    async: true,
                                    success: function(res) {
                                        layer.closeAll();
                                        layer.msg(res.msg);
                                        for (var i = datas.length - 1; i >= 0; i--) {
                                            var indexNum = datas[i]['_ys_sub_grid_index'];
                                            t1.c.sonlist.splice(indexNum, 1);
                                        }
                                        t1.reloadGrid();
                                    }, error: function() {
                                        layer.closeAll();
                                        layer.msg("删除失败，请稍后再试！", { icon: 2 });
                                    }
                                });
                            }else {
                                for (var i = datas.length - 1; i >= 0; i--) {
                                    var index = datas[i]['_ys_sub_grid_index'];
                                    t1.c.sonlist.splice(index, 1);
                                }
                                t1.reloadGrid();
                            }

                        }, function() {
                        });
                    }
                    break;
                }
            };
        },
		listenGrid35: function(obj, checkedDatas) {// 万里汇外币付款单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var payType = $('select[name="payType"]').val();
					if(payType == 1) {
						var selectedDatas = [];
						//回填数据的代码
						var gridDatas = t.c.subGridObj.getData();
						for (var i = 0; i < gridDatas.length; i++) {
							var row = {};
							row = gridDatas[i];
							row.id = row.relativeId;
							selectedDatas.push(row);
						}
						layui.YsModal.init({modalKey: 'THR_TransparencyProgram', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					} else if(payType == 2) {
						var selectedDatas = [];
						//回填数据的代码
						var gridDatas = t.c.subGridObj.getData();
						for (var i = 0; i < gridDatas.length; i++) {
							var row = {};
							row = gridDatas[i];
							row.id = row.relativeId;
							selectedDatas.push(row);
						}
						layui.YsModal.init({modalKey: 'THR_VatApplyDetail', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					} else if(payType == 3) {
						t.c.subGridObj.c.sonlist.push({
							fee: 0
						});
						t.c.subGridObj.reloadGrid();
						break;
					} else {
						layer.msg('支付类型有误');
					}
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();

				    var domForm = $('#' + window.formObj.c.id_form);
					var exchangeRate = parseFloat(domForm.find('input[name="exchangeRate"]').val()); // 计算汇率

					// 若金额变动，则计算外币总金额及CNY总金额
					if(exchangeRate) {
						var amountTotalLocal = 0;
						var amountTotalCny = 0;
						for (var i = 0; i < t.c.subGridObj.c.sonlist.length; i++) {
							var amount = parseFloat(t.c.subGridObj.c.sonlist[i]['amount']);
							if(amount) {
								amountTotalLocal = amountTotalLocal + amount;
								amountTotalCny = amountTotalCny + amount * exchangeRate;
							}
						}
						domForm.find('input[name="amountTotalLocal"]').val(amountTotalLocal);
						domForm.find('input[name="amountTotalCny"]').val(Math.round(amountTotalCny * 100) / 100);
					}
					break;
				}
			};
		},
		listenGrid36: function(obj, checkedDatas) {// 万里汇预付款对账单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						row.id = row.wanliPrepaymentPoolingId;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCW_WanliPrepaymentPooling', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid37: function(obj, checkedDatas) {//财务工资小计部门维护
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row = gridDatas[i];
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TS_OrganizationInfo_ByFinanceSalary', type: 'checkbox', uniqueKey: 'orgid', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid38: function(obj, checkedDatas) {// 预约调拨取消单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var data = gridDatas[i];

						selectedDatas.push({
	                		id: data.allocateDetailId,
	                		vgsbmFrom: data.vgsbmFrom,
	                		vgsjcFrom: data.vgsjcFrom,
	                		vgsbmTo: data.vgsbmTo,
	                		vgsjcTo: data.vgsjcTo,
	                		productCode: data.productCode,
	                		productName: data.productName
		                });
					}
					layui.YsModal.init({modalKey: 'TCC_AllocateDetail-Un_Distribute', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid39: function(obj, checkedDatas) {// 手工分配单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var domForm = $('#' + window.formObj.c.id_form);
					var vgsbm = domForm.find('input[name="vgsbm"]').val();
					if(vgsbm==undefined || vgsbm==null || vgsbm==''){
						return layer.msg("请先选择调出公司编码！");
					}
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var data = gridDatas[i];

						selectedDatas.push({
	                		id: data.allocateDetailId,
	                		vgsbmFrom: data.vgsbmFrom,
	                		vgsjcFrom: data.vgsjcFrom,
	                		vgsbmTo: data.vgsbmTo,
	                		vgsjcTo: data.vgsjcTo,
	                		productCode: data.productCode,
	                		productName: data.productName,
							num: data.allocateNum,
							depotId: data.depotId,
							depotName: data.depotName,
							bid: data.bidAllocate,
							purchaseSinglePrice: data.singlePrice,
							distributedNum: data.distributedNum,
							canceledNum: data.canceledNum,
		                });
					}
					layui.YsModal.init({modalKey: 'TCC_AllocateDetail-Un_DistributeFp', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: ''
						, pathGridRequest: '/api/inter/tccAllocate/searchDetailUnDistributeFp?vgsbmFrom='+vgsbm});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},


		listenGrid40: function(obj, checkedDatas) {//员工档案表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						userId : window.formObj.getValueByName('userId'),
						recordTime : "",
						recordType : '0',
						remark : "",
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},


		listenGrid41: function(obj, checkedDatas) {//职能费用申请子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: "",
						vgsbm : "",
						vgsjc : "",
						transactionTypeBid : "",
						vremark : "",
						recoverableAmount : '0',
						userBankInfoId : "",
						_ys_uerBankInfoUserName : "",
						vyhzhmc : "",
						vkhh : "",
						vyhzh : "",
						sRemark : "",
						annexFile : "0个附件",
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid42: function(obj, checkedDatas) {//付款申请单子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: "",
						vgsbm : "",
						vgsjc : "",
						transactionTypeBid : "",
						vremark : "",
						paymentAmount : "0",
						partnerBankInfoId : "",
						vid : "",
						partnerName : "",
						vkhh : "",
						vyhzh : "",
						remark : "",
						annexFile : "0个附件",
						receiptAnnexFile : "0个附件",
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid43: function(obj, checkedDatas) {//财务交易类型子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					layui.YsModal.init({modalKey: 'TB_BaseInfo_ByJylx', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: 'orgName'});
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tcwFinancialTransactionType/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},

		listenGrid44: function(obj, checkedDatas) {//费用结算返还单子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						row.id = row.accountDetailedForCompanyId;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCW_AccountDetailedForCompany_BySettleReturn', type: 'checkbox', uniqueKey: 'id', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: 'orgName'});
					break;
					/*
					t.c.subGridObj.c.sonlist.push({
						id: null,
						accountDetailedForCompanyId:null
					});
					t.c.subGridObj.reloadGrid();
					break;
					 */
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}

				case 'event-to-setReturnAmount': // 交易金额 设置为 返还金额
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var sonlist = t1.c.sonlist;
						for (var i = 0; i < datas.length; i++) {
							for (var j = 0; j < sonlist.length; j++) {
								if(datas[i].accountDetailedForCompanyId==sonlist[j].accountDetailedForCompanyId){
									t1.c.sonlist[j].returnAmount = t1.c.sonlist[j].fje;
								}
							}
						}
						t1.reloadGrid();
					}
					break;
				}


				case 'event-to-setRemark': // 批量设置返还原因
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var sonlist = t1.c.sonlist;
						var w2 = ($(window).width() * 0.7);
						var h2 = ($(window).height() * 0.5);
						layer.open({
							shadeClose:true,
							area: [w2 + 'px', h2 + 'px'],
							title: '批量设置返还原因',
							content: `
									<form class="layui-form">
									  <div class="layui-form-item">
										<label class="layui-form-label">返还原因</label>
										<div class="layui-input-block">
										  <input type="text" name="setRemark" id="setRemark" placeholder="请输入返还原因" class="layui-input">
										</div>
									  </div>
									</form>
								`,
							success: function(layero, index) {},
							yes: function (index, layero) {
								layer.msg('处理中', {icon: 16,shade: 0.01});
								var setRemark = $('#setRemark').val();
								for (var i = 0; i < datas.length; i++) {
									for (var j = 0; j < sonlist.length; j++) {
										if(datas[i].accountDetailedForCompanyId==sonlist[j].accountDetailedForCompanyId){
											t1.c.sonlist[j].returnReason = setRemark;
										}
									}
								}
								layer.closeAll();
								t1.reloadGrid();
							}
						});



					}
					break;
				}



			};
		},

		listenGrid45: function(obj, checkedDatas) {//费用划拨单子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						accountDetailedForCompanyId:null
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tcwExpenseAllocation/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},

		listenGrid46: function(obj, checkedDatas) {//费用结算单子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						accountDetailedForCompanyId:null
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tcwExpenseSettlement/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},

		listenGrid47: function(obj, checkedDatas) {//采购合同单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var vname = window.formObj.getValueByName("vname");//购买方公司名称
					if(vname==undefined || vname==null || vname==''){
						return layer.msg("请先选择购买方公司名称！");
					}

					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCG_PurchaseAppointOrder_ItemByContract', type: 'checkbox', uniqueKey: 'orderProductComponentId', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [{code: 'CI.Vname', value:vname}],sameCode: 'aaa'});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid49: function(obj, checkedDatas) {//采购预入库明细
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增采购预入库明细
				{
					var purchaseContractBid = window.formObj.getValueByName("purchaseContractBid");
					if (purchaseContractBid == null || purchaseContractBid == ''){
						return layer.msg("采购合同单号未选择,不允许新增!");
					}
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row.purchaseContractItemId = gridDatas[i].purchaseContractItemId;
						row.purchaseContractBid = gridDatas[i].purchaseContractBid;
						row.appointOrderBid = gridDatas[i].appointOrderBid;
						row.vgsbm = gridDatas[i].vgsbm;
						row.vgsjc = gridDatas[i].vgsjc;
						row.productCode = gridDatas[i].productCode;
						row.productName = gridDatas[i].productName;
						row.accountType = gridDatas[i].accountType;
						row.codeMerge = gridDatas[i].codeMerge;
						row.subCode = gridDatas[i].subCode;
						row.subName = gridDatas[i].subName;
						row.subCodeMerge = gridDatas[i].subCodeMerge;
						row.subPurchasePrice = gridDatas[i].subPurchasePrice;
						row.subBomNumber = gridDatas[i].subBomNumber;
						row.subNotStorageNum = gridDatas[i].subNotStorageNum;
						row.preStorageNum = gridDatas[i].preStorageNum;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCG_PurchaseContractItemSonPre', type: 'checkbox', uniqueKey: 'purchaseContractItemId', parentObj: t.c.subGridObj, selectedData: selectedDatas, extraData:{}, conditionsDefault: [],sameCode: 'purchaseContractBid'
						, pathGridRequest: '/api/inter/tcgPurchaseContract/purchaseContractItemSonPre?purchaseContractBid='+purchaseContractBid});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid51: function(obj, checkedDatas) {
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = {};
						row.subCode = gridDatas[i].subCode;
						row.subName = gridDatas[i].subName;
						row.subBomNumber = gridDatas[i].subBomNumber;
						row.subBomPrice = gridDatas[i].subBomPrice;
						row.productCode = gridDatas[i].productCode;
						row.productName = gridDatas[i].productName;
						row.codeMerge = gridDatas[i].codeMerge;
						row.subCodeMerge = gridDatas[i].subCodeMerge;
						row.createTime = gridDatas[i].createTime;
						row.updateTime = gridDatas[i].updateTime;
						selectedDatas.push(row);
					}
					layui.YsModal.init({modalKey: 'TCG_PurchaseAppointOrderItem', type: 'checkbox', uniqueKey: 'subCode', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: 'orgName'});
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var t2=t1.c.sonlist;
						var newlist = [];
						for(var z=0;z<t2.length;z++){
							var t3 = false;
							for(var i=0;i<datas.length;i++){
								var productCode=datas[i].productCode;
								var pcode = t2[z].productCode;
								if(pcode ==productCode){
									t3 = true;
								}
							}
							if(t3==false){
								newlist.push(t2[z]);
							}

						}
						t1.c.sonlist=newlist;
						t1.reloadGrid();
						var preAccount=0;
						for(var z=0;z<t1.c.sonlist.length;z++){
							if(t1.c.sonlist[z]['subTotalPrice']){
								var subTotalPrice=parseFloat(t1.c.sonlist[z]['subTotalPrice']);
								preAccount+=subTotalPrice;

							}

						}
						var domForm = $('#' + window.formObj.c.id_form);
						domForm.find('input[name="preAccount"]').val(preAccount.toFixed(2));
					}

					break;
				}
			};
		},


		listenGrid52: function(obj, checkedDatas) {//发票预核销单
			var t = this;
			var t1 = t.c.subGridObj;
			switch(obj.event){
				case 'event-to-add': // 新增发票预核销单
				{
					//购买方公司名称
					var vname = window.formObj.getValueByName("vname");
					if (vname == null || vname == ''){
						return layer.msg("购买方公司名称未选择,不允许新增!");
					}
					//供应方公司名称
					var partnerName = window.formObj.getValueByName("partnerName");
					if (partnerName == null || partnerName == ''){
						return layer.msg("供应方公司名称未选择,不允许新增!");
					}

					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						selectedDatas.push(row);
					}
					layui.YsModal.init({
						modalKey: 'TCG_PurchaseContractByManage_InvoiceOffset',
						type: 'checkbox',
						uniqueKey: 'itemId',
						parentObj: t.c.subGridObj,
						selectedData: selectedDatas,
						extraData:{},
						conditionsDefault: [{code: 'CI.Vname', value:vname},{code: 'PB.PartnerName', value:partnerName}],
						sameCode: 'itemId'
					});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					var offsetTotalAmount = 0 ;
					if(t1.c.sonlist!=null && t1.c.sonlist.length>0){
						for(var i=0;i<t1.c.sonlist.length;i++){
							if(t1.c.sonlist[i].offsetAmount){
								offsetTotalAmount = offsetTotalAmount+parseFloat(t1.c.sonlist[i].offsetAmount);
							}
						}
					}
					var domForm = $('#' + window.formObj.c.id_form);
					//回填核销总额
					domForm.find('input[name="offsetTotalAmount"]').val(offsetTotalAmount.toFixed(2));
					break;
				}
			};
		},

		listenGrid53: function(obj, checkedDatas) {//采购付款单
			var t = this;
			var t1 = t.c.subGridObj;
			switch(obj.event){
				case 'event-to-add': // 新增采购付款单
				{
					//购买方公司名称
					var companyBankInfoName = window.formObj.getValueByName("companyBankInfoName");
					if (companyBankInfoName == null || companyBankInfoName == ''){
						return layer.msg("购买方公司名称未选择,不允许新增!");
					}
					//供应方公司名称
					var partnerBankInfoName = window.formObj.getValueByName("partnerBankInfoName");
					if (partnerBankInfoName == null || partnerBankInfoName == ''){
						return layer.msg("供应方公司名称未选择,不允许新增!");
					}

					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						row.vname = gridDatas[i].companyBankInfoName
						row.partnerName = gridDatas[i].partnerBankInfoName
						row.subPaymentNum = gridDatas[i].subPaidNum
						row._ys_CreateTime = gridDatas[i]._ys_CreateTime
						selectedDatas.push(row);
					}
					layui.YsModal.init({
						modalKey: 'TCG_PurchaseContractCg',
						type: 'checkbox',
						uniqueKey: 'purchaseContractItemId',
						parentObj: t.c.subGridObj,
						selectedData: selectedDatas,
						extraData:{},
						conditionsDefault: [{code: 'CI.Vname', value:companyBankInfoName},{code: 'PB.PartnerName', value:partnerBankInfoName}],
						sameCode: 'purchaseContractItemId'
					});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					t.c.subGridObj.removeRowsChecked();
					var purchasePrice = 0 ;
					var paidAmount = 0 ;
					var currentPaymentAmount = 0 ;
					if(t1.c.sonlist!=null && t1.c.sonlist.length>0){
						for(var i=0;i<t1.c.sonlist.length;i++){
							if(t1.c.sonlist[i].subThisPaidNum){
								purchasePrice = purchasePrice+parseFloat(t1.c.sonlist[i].subPurchasePrice);
								//（子件已付款数量*子件采购单价）之和
								var subPurchasePrice=parseFloat(t1.c.sonlist[i]['subPurchasePrice']);
								var subPaidAmount = (parseFloat(t1.c.sonlist[i]['subPaidNum'])* subPurchasePrice).toFixed(2);
								paidAmount = paidAmount + parseFloat(subPaidAmount);
								//（子件本次付款数量*子件采购单价）之和
								var subThisPaidNum = (parseFloat(t1.c.sonlist[i]['subThisPaidNum'])* subPurchasePrice).toFixed(2);
								currentPaymentAmount = currentPaymentAmount + parseFloat(subThisPaidNum);
							}
						}
					}
					var domForm = $('#' + window.formObj.c.id_form);
					//回填采购总价
					domForm.find('input[name="purchasePrice"]').val(purchasePrice.toFixed(2));
					//回填已付款金额
					domForm.find('input[name="paidAmount"]').val(paidAmount.toFixed(2));
					//回填本次付款总额
					domForm.find('input[name="currentPaymentAmount"]').val(currentPaymentAmount.toFixed(2));
					break;
				}
			};
		},


		listenGrid56: function(obj, checkedDatas) {//listing库子件
			var t = this;
			var t1 = t.c.subGridObj;
			switch(obj.event){
				case 'event-to-add': // 新增listing子件
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						pcode:window.formObj.getValueByName('code'),
						code: '保存后自动生成',
						name: '',
						subCodeMerge: '',
						num: '',
						bprice: '',
						linkIn: '',
						linkInMark: '',
						remark: '',
						invoiceModelNo: '',
						invoiceName: '',
						customsCode: '',
						countryName: '',
						exemptionTax: '',
						customsExplain: '',
						singleWeight: '',
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-del': // 删除选中数据
				{

					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						if (datas.length >= t.c.subGridObj.c.sonlist.length){
							return layer.msg("删除失败,子件列表至少需要一条!");
						}
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								var ids = '';
								for(var i=0;i<_list.length;i++){
									if(ids==''){
										ids = _list[i];
									}else {
										ids = ids + ',' +_list[i];
									}
								}
								$.ajax({
									url: '/api/inter/tpProductActive/toDel',
									//data: "list=" + _list+"&code="+t.c.formObj.getValueByName('code'),
									data: {ids: ids,code:window.formObj.getValueByName('code')},
									type: 'POST',
									async: true,
									success: function(res) {
										if(res.code==0){
											console.log('res',res);
											layer.close();
											layer.msg(res.msg);
											for (var i = datas.length - 1; i >= 0; i--) {
												var indexNum = datas[i]['_ys_sub_grid_index'];
												t1.c.sonlist.splice(indexNum, 1);
											}
											t1.reloadGrid();
										}else {
											layer.close();
											layer.msg(res.msg, { icon: 2 });
										}

									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});

					}


					break;
				}

				case 'event-to-ph': // 铺货
				{
					var zbThis = this;
					var loadIndex = layer.confirm('确定要铺货?', {icon: 3}, function () {
						//点击确定的回调
						layer.close(loadIndex);
						var t = this;
						var c = this.c;
						if (zbThis.c.subGridObj.c.sonlist.length < 0){
							return layer.msg("铺货失败,子件信息至少需要一条!");
						}
						var loadIndex = layer.load(2);
						$.ajax({
							url: '/api/inter/1688/get1688ProductDetail',
							data: {
								'code':window.formObj.getValueByName("code")},
							type: 'POST',
							async: true,
							success: function (result) {
								if(result.code==0){
									layer.close(loadIndex);
									layer.msg(result.msg, {icon: 1});
									c.data = newData;
									$('#' + c.id).empty();
									return t.reload(c);

								}else {//失败
									layer.close(loadIndex);
									layer.msg(result.msg, {icon: 2});
								}
							},
							error: function () {
								layer.close(loadIndex);
								layer.msg("铺货失败，请稍后再试！", {icon: 2});
							}
						});
					}, function () {});//点击取消的回调
					break;
				}

			};
		},


		listenGrid58: function(obj, checkedDatas) {//报关单
			var t = this;
			var t1 = t.c.subGridObj;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					//子列表去重，根据报关信息子件表id
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						if(i==0){
							selectedDatas.push(row);
						}else {
							var isAdded = false;
							for(var j = 0; j < selectedDatas.length; j++){
								if(selectedDatas[j].decCustomSubId == gridDatas[i].decCustomSubId){
									isAdded = true;
								}
							}
							if(!isAdded){
								selectedDatas.push(row);
							}
						}

					}
					layui.YsModal.init({
						modalKey: 'TL_DecCustom_By_CustomsDeclaration',
						type: 'checkbox',
						uniqueKey: 'onlyOneKey',
						parentObj: t.c.subGridObj,
						selectedData: selectedDatas,
						extraData:{},
						conditionsDefault: [],
						sameCode: 'onlyOneKey'
					});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						for (var i = t1.c.sonlist.length - 1; i >= 0; i--) {
							var isDel = false;
							for(var j = datas.length - 1; j >= 0; j--){
								if(datas[j].decCustomSubId == t1.c.sonlist[i].decCustomSubId){
									isDel = true;
								}
							}
							if(isDel){
								var indexNum = datas[i]['_ys_sub_grid_index'];
								t1.c.sonlist.splice(indexNum, 1);
							}
						}
						$.ajax({
							url: '/api/inter/tlCustomsDeclaration/getInvoiceDeductionAddInvoice',
							data: {subData:JSON.stringify(t1.c.sonlist)} ,
							type: 'POST',
							async: false,
							success: function (res) {
								console.log('aaa',res)
								if (res.code == 0) {
									t1.c.sonlist = res.resList;
									t1.reloadGrid();
								}
							}
						});
						//t1.reloadGrid();

					}
					//t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},


		listenGrid61: function(obj, checkedDatas) {//listing库网店子表
			var t = this;
			var t1 = t.c.subGridObj;
			switch(obj.event){
				case 'event-to-add': // 新增
				{

					t.c.subGridObj.c.sonlist.push({
						id : null,
						code : window.formObj.getValueByName('code'),
						sellerSku : '',
						asin : '',
						fnSku : '',
						isSign : '否',
						signCode : '',
						sellerId : '',
						shopName : '',
						marketplaceName : '',
						countIsShow : 1,
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-del': // 删除
				{

					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {

						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除SKU信息吗？', { icon: 3 }, function() {
							layer.msg('处理中', { icon: 16, shade: 0.01 });
							var ids = '';
							for(var i=0;i<_list.length;i++){
								if(ids==''){
									ids = _list[i];
								}else {
									ids = ids + ',' +_list[i];
								}
							}
							$.ajax({
								url: '/api/inter/tpAmazonShopProduct/delByIds',
								data: {ids: ids},
								type: 'POST',
								async: true,
								success: function(res) {
									layer.close();
									layer.msg(res.msg);
									for (var i = datas.length - 1; i >= 0; i--) {
										var indexNum = datas[i]['_ys_sub_grid_index'];
										t1.c.sonlist.splice(indexNum, 1);
									}
									t1.reloadGrid();
								}, error: function() {
									layer.close();
									layer.msg("删除失败，请稍后再试！", { icon: 2 });
								}
							});

						}, function() {
						});

					}
					break;
				}

				case 'event-to-print': // 打印预览
				{
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if(datas.length == 0) {
						layer.alert('尚未选中数据');
					} else if(datas.length > 1) {
						layer.alert('只能选中一行数据');
					} else {
						$.ajax({
							type: "POST",
							url: '/api/inter/tpAmazonShopProduct/doPrint',
							data: {id: datas[0].id},
							success: function (data) {
								if (data.code == 0) {
									if(data.msg != undefined && data.msg.startsWith('http')) {
										window.open(data.msg);
									} else {
										layer.msg(data.msg);
									}
								} else {
									alert(data.msg);
								}
							}
						});
					}
					break;
				}
			};
		},
		listenGrid62: function(obj, checkedDatas) {//公司账户资金转账子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						accountDetailedForCompanyId:null
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tcwExpenseSettleReturn/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},



		listenGrid63: function(obj, checkedDatas) {//采购计划
			var t = this;
			var t1 = t.c.subGridObj;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//运营公司编码
					var vgsbm = window.formObj.getValueByName("vgsbm");
					if (vgsbm == null || vgsbm == ''){
						return layer.msg("请先选择运营公司编码!");
					}
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						var code = row.spBm;
						var isAdd = true;

						if(selectedDatas!=null && selectedDatas.length>0){
							for(var j=0;j<selectedDatas.length;j++){
								if(code==selectedDatas[j].code){
									isAdd = false;
								}
							}
						}
						if(isAdd){
							selectedDatas.push({code:row.spBm,name:row.spName,vgsbm:row.vgsbmBySub,vgsjc:row.vgsjcBySub});
						}

					}
					console.log('selectedDatas',selectedDatas);
					layui.YsModal.init({
						modalKey: 'TP_ProductActive_ByPlan',
						type: 'checkbox',
						uniqueKey: 'code',
						parentObj: t.c.subGridObj,
						selectedData: selectedDatas,
						extraData:{},
						conditionsDefault: [],
						//sameCode: 'code'
					});
					break;
				}
				case 'event-to-delete': // 删除选中数据
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var newList = [];
						//遍历子列表，将相同的母件商品编码对应的子件编码全部删除
						for(var i=0;i<t1.c.sonlist.length;i++){
							var row = t1.c.sonlist[i];
							var isDel = false;
							for(var j=0;j<datas.length;j++){
								if(datas[j].spBm == row.spBm){
									isDel = true;
								}
							}
							if(!isDel){
								newList.push(row);
							}
						}
						t1.c.sonlist = newList;

						//重新计算采购预估金额
						var totalPrice = 0 ;
						if(t1.c.sonlist!=null && t1.c.sonlist.length>0){
							for(var i=0;i<t1.c.sonlist.length;i++){
								if(t1.c.sonlist[i].subTotalPrice){
									totalPrice = totalPrice+parseFloat(t1.c.sonlist[i].subTotalPrice);
								}
							}
						}
						var domForm = $('#' + window.formObj.c.id_form);
						//回填采购预估金额
						domForm.find('input[name="totalPrice"]').val(totalPrice.toFixed(2));

						t1.reloadGrid();

					}

					break;
				}
			};
		},

		listenGrid65: function(obj, checkedDatas) {//入账申请单子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: "",
						vgsbm : "",
						vgsjc : "",
						transactionTypeBid : "",
						vremark : "",
						entryAmount : "0",
						partnerBankInfoId : "",
						vid : "",
						partnerName : "",
						vkhh : "",
						vyhzh : "",
						remark : "",
						annexFile : "0个附件",
						receiptAnnexFile : "0个附件",
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid66: function(obj, checkedDatas) {//费用划拨管理单子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						accountDetailedForCompanyId:null
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tcwExpenseAllocationByManage/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},




		listenGrid67: function(obj, checkedDatas) {//预约调拨发布单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						publishAmountBySon:0,
						status:1
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete-batch': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid68: function(obj, checkedDatas) {//线上质检上架
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						subPutonNum:0
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if(datas!=null && datas.length>0){
						if(t1.c.sonlist.length==datas.length){
							return layer.alert('请至少保留一条货位设置信息');
						}
					}
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid70: function(obj, checkedDatas) {//线上采购退货单
			var t = this;
			switch(obj.event){
				case 'event-to-export': // 导出出库清单
				{
					if (t.c.subGridObj.c.sonlist.length == 0){
						return layer.msg("删除失败,子件列表至少需要一条!");
					}
					var bid = window.formObj.getValueByName("bid");
					$.ajax({
						type: "POST",
						url: '/api/inter/tccOnlinePurchaseReturn/exportZj',
						data: {"bid":bid},
						success: function (data) {
							if (data.code == 0) {
								if(data.msg != undefined && data.msg.startsWith('http')) {
									window.open(data.msg);
								} else {
									layer.msg(data.msg);
								}
							} else {
								alert(data.msg);
							}
						}
					});
					break;
				}
			};
		},

		listenGrid71: function(obj, checkedDatas) {//手工组装单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//商品编码
					var productCode = window.formObj.getValueByName("productCode");
					if (productCode == null || productCode == ''){
						return layer.msg("请先选择母件商品信息!");
					}
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						var subCode = row.subCode;
						var isAdd = true;
						if(selectedDatas!=null && selectedDatas.length>0){
							for(var j=0;j<selectedDatas.length;j++){
								if(subCode==selectedDatas[j].code){
									isAdd = false;
								}
							}
						}
						if(isAdd){
							selectedDatas.push({_ys_pCode:productCode,code:row.subCode,name:row.subName,num:row.subBomNum});
						}

					}
					console.log('selectedDatas',selectedDatas);
					layui.YsModal.init({
						modalKey: 'TP_ProductActiveComponent_ByPcode',
						type: 'checkbox',
						uniqueKey: 'code',
						parentObj: t.c.subGridObj,
						selectedData: selectedDatas,
						extraData:{},
						conditionsDefault: [{code: '_ys_pCode', value:productCode}],
						//sameCode: 'code'
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},


		listenGrid72: function(obj, checkedDatas) {//手工拆装单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 批量设置仓库
				{
					/*
					//商品编码
					var productCode = window.formObj.getValueByName("productCode");
					if (productCode == null || productCode == ''){
						return layer.msg("请先选择母件商品信息!");
					}
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var row = gridDatas[i];
						var subCode = row.subCode;
						var isAdd = true;
						if(selectedDatas!=null && selectedDatas.length>0){
							for(var j=0;j<selectedDatas.length;j++){
								if(subCode==selectedDatas[j].code){
									isAdd = false;
								}
							}
						}
						if(isAdd){
							selectedDatas.push({_ys_pCode:productCode,code:row.subCode,name:row.subName,num:row.subBomNum});
						}

					}
					console.log('selectedDatas',selectedDatas);
					layui.YsModal.init({
						modalKey: 'TP_ProductActiveComponent_ByPcode',
						type: 'checkbox',
						uniqueKey: 'code',
						parentObj: t.c.subGridObj,
						selectedData: selectedDatas,
						extraData:{},
						conditionsDefault: [{code: '_ys_pCode', value:productCode}],
						//sameCode: 'code'
					});

					 */

					var t = this.c.subGridObj;
					var t1 = this;
					var checkStatus = layui.table.checkStatus(t.c.id_table_sub);
					var checkedDatas = checkStatus.data;

					if(checkedDatas!=null && checkedDatas.length>0){
						layui.YsModal.init({
							modalKey: 'TCC_Location',
							uniqueKey: 'chw',
							colCode: 'aaa',
							parentObj: t1.c.subGridObj,
							extraData:checkedDatas
						})
						/*
						layui.YsModal.init({
							modalKey: 'TP_ProductActiveComponent_ByPcode',
							type: 'checkbox',
							uniqueKey: 'code',
							parentObj: t.c.subGridObj,
							selectedData: selectedDatas,
							extraData:checkedDatas,
							//conditionsDefault: [{code: '_ys_pCode', value:productCode}],
							//sameCode: 'code'
						});

						 */



					}





					break;
				}
				case 'event-to-delete': // 删除
				{
					//t.c.subGridObj.removeRowsChecked();
					var t = this.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t.c.id_table_sub);
					var checkedDatas = checkStatus.data;
					for (var i = checkedDatas.length - 1; i >= 0; i--) {
						var index = checkedDatas[i]['_ys_sub_grid_index'];
						var codeNum = 0;
						for(var j=0;j<t.c.sonlist.length;j++){
							if(checkedDatas[i]['subCode'] == t.c.sonlist[j]['subCode']){
								codeNum++;
							}
						}
						if(codeNum>1){
							t.c.sonlist.splice(index, 1);
						}
					}

					t.reloadGrid();
					break;
				}
			};
		},


		listenGrid74: function(obj, checkedDatas) {//库存调拨单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({
						modalKey: 'TCC_StockControl_ByAllocate',
						type: 'checkbox',
						uniqueKey: 'stockControlIdByOld',
						parentObj: t.c.subGridObj,
						selectedData: gridDatas,
						extraData:{},
						conditionsDefault: [],
						//sameCode: 'code'
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},

		listenGrid75: function(obj, checkedDatas) {//货位转移单
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({
						modalKey: 'TCC_StockControlZy',
						type: 'checkbox',
						uniqueKey: 'id',
						parentObj: t.c.subGridObj,
						selectedData: gridDatas,
						extraData:{},
						conditionsDefault: [],
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
				case 'event-to-import': // 批量导入货位
				{
					window.matchValuesAfterModalSelectRadio = function(colCode, data, extraData) {
						console.log('data =',data);
						var gridDatas = t.c.subGridObj.getData();
						console.log('gridDatas =',gridDatas);
						for (var i = 0; i < gridDatas.length; i++) {
							gridDatas[i].vckYr = data.vck
							gridDatas[i].vkqYr = data.vkq
							gridDatas[i].vhwYr = data.vhw
							gridDatas[i].chw = data.chw
						}

						t.c.subGridObj.reloadGrid();
					};
					layui.YsModal.init({modalKey: 'TCC_Location', colCode: 'aaaa', parentObj: window});
					break;
				}

			};
		},

		listenGrid76: function(obj, checkedDatas) {//库存出库子表
			var t = this;
			switch(obj.event){

				case 'event-to-add': // 新增
				{
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({
						modalKey: 'TCC_StockControl_ByAllocate',
						type: 'checkbox',
						uniqueKey: 'controlId',
						parentObj: t.c.subGridObj,
						selectedData: gridDatas,
						extraData:{},
						conditionsDefault: [],
					});
					break;
				}
				case 'event-to-delete-batch': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tccStockOutbound/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},
		listenGrid78: function(obj, checkedDatas) {//FBA计划单子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					var shopName = window.formObj.getValueByName("shopName");
					if (shopName == null || shopName == ''){
						return layer.msg("请先选择网店名称!");
					}
					//物流方式
					var logsticsWay = window.formObj.getValueByName("logsticsWay");
					if (logsticsWay == null || logsticsWay == ''){
						return layer.msg("请先选择物流方式!");
					}
					var vgsbm = window.formObj.getValueByName("vgsbm");
					var cck = window.formObj.getValueByName("cck");
					var shopId = window.formObj.getValueByName("shopId");
					var selectedDatas = [];
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					for (var i = 0; i < gridDatas.length; i++) {
						var data = gridDatas[i];

						selectedDatas.push({
							id: data.id,
							commodityCode:data.commodityCode,
							commodityName:data.commodityName,
							sku:data.sku,
							numStock:data.numStock,
							isSign:data.isSign,
							signCode:data.signCode,
							asin:data.asin,
							fnSku:data.fnSku,
							codeGoodsHs:data.codeGoodsHs,
							nameGoodsCn:data.nameGoodsCn,
							nameMaterialCn:data.nameMaterialCn,
							nameUnitCn:data.nameUnitCn,
							priceIn:data.priceIn,
							lengthPackage:data.lengthPackage,
							widthPackage:data.widthPackage,
							heightPackage:data.heightPackage,
							packageSize:data.packageSize,
							// weightPackage:(data.weightPackage/1000).toFixed(2),
							weightPackage:data.weightPackage,
							vck:data.vck,
							vkq:data.vkq,
							vhw:data.vhw,
							chw:data.chw,
							declarationState:data.declarationItemState,
							declarationStateName:data.declarationItemStateName,
							stockControlId:data.stockControlId,
							amazonShopProductId:data.amazonShopProductId,
						});
					}
					layui.YsModal.init({modalKey: 'TCC_StockControl_FbaPlan', type: 'checkbox', uniqueKey: 'stockControlId', parentObj: t.c.subGridObj, selectedData: selectedDatas, sameCode: 'declarationStateName'
						, pathGridRequest: '/api/inter/tccStockControl/searchFbaPlan?vgsbm='+vgsbm + "&cck="+cck+ "&shopId="+shopId});
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		

		listenGrid77: function(obj, checkedDatas) {//库存入库子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({
						modalKey: 'TP_ProductBasisChildNew',
						type: 'checkbox',
						uniqueKey: 'code',
						parentObj: t.c.subGridObj,
						selectedData: gridDatas,
						extraData:{},
						conditionsDefault: [],
					});
					break;
				}
				case 'event-to-delete-batch': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tccStockStore/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},

		listenGrid85: function(obj, checkedDatas) {//运输类型维护子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
						transportationTypeZbCn:0
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},





		listenGrid80: function(obj, checkedDatas) {//HW商品选品库子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({
						modalKey: 'TOS_ProductBasisXp',
						type: 'checkbox',
						uniqueKey: 'code',
						parentObj: t.c.subGridObj,
						selectedData: gridDatas,
						extraData:{},
						conditionsDefault: [],
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid81: function(obj, checkedDatas) {//HW采购计划子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//商品编码
					var shopName = window.formObj.getValueByName("shopName");
					if (shopName == null || shopName == ''){
						return layer.msg("请先选择店铺名称信息!");
					}
					var vgsBm = window.formObj.getValueByName("vgsBm");
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();

					layui.YsModal.init({modalKey: 'TOS_ProductSelectionJh', type: 'checkbox', uniqueKey: 'productSelectionItemId', parentObj: t.c.subGridObj, selectedData: gridDatas, sameCode: 'currencyCode'
						, pathGridRequest: '/api/inter/tosProductSelection/searchJh?vgsBm='+vgsBm});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},



		listenGrid89: function(obj, checkedDatas) {//物流付款单（关税费）
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({
						modalKey: 'TCC_LogisticsComprehensive_PayGs',
						type: 'checkbox',
						uniqueKey: 'logInvoiceNo',
						parentObj: t.c.subGridObj,
						selectedData: gridDatas,
						extraData:{},
						conditionsDefault: [],
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},
		listenGrid91: function(obj, checkedDatas) {//物流服务商子表
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-delete': // 删除
				{
					var t1 = t.c.subGridObj;
					var checkStatus = layui.table.checkStatus(t1.c.id_table_sub);
					var datas = checkStatus.data;
					if (datas.length == 0) {
						layer.alert('尚未选中数据');
					} else {
						var _list = [];
						//console.log('datas',datas);
						for (var i = 0; i < datas.length; i++) {
							if(datas[i].id!=undefined && datas[i].id!=null && datas[i].id!=''){
								_list.push(datas[i].id);
							}
						}
						layer.confirm('确定要删除吗？', { icon: 3 }, function() {
							//console.log('_list',_list);
							if(_list!=null && _list.length>0){
								layer.msg('处理中', { icon: 16, shade: 0.01 });
								$.ajax({
									url: '/api/inter/tccLogisticsServiceProvider/toDelByItem',
									data: "list=" + _list,
									type: 'POST',
									async: true,
									success: function(res) {
										layer.close();
										layer.msg(res.msg);
										for (var i = datas.length - 1; i >= 0; i--) {
											var indexNum = datas[i]['_ys_sub_grid_index'];
											t1.c.sonlist.splice(indexNum, 1);
										}
										t1.reloadGrid();
									}, error: function() {
										layer.close();
										layer.msg("删除失败，请稍后再试！", { icon: 2 });
									}
								});
							}else {
								for (var i = datas.length - 1; i >= 0; i--) {
									var index = datas[i]['_ys_sub_grid_index'];
									t1.c.sonlist.splice(index, 1);
								}
								layer.closeAll();
								layer.msg("删除成功！");
								t1.reloadGrid();
							}

						}, function() {
						});
					}
					break;
				}
			};
		},

		listenGrid93: function(obj, checkedDatas) {//C88文件管理
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					t.c.subGridObj.c.sonlist.push({
						id: null,
					});
					t.c.subGridObj.reloadGrid();
					break;
				}
				case 'event-to-del': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
			};
		},



		listenGrid90: function(obj, checkedDatas) {//物流付款单（物流费）
			var t = this;
			switch(obj.event){
				case 'event-to-add': // 新增
				{
					//回填数据的代码
					var gridDatas = t.c.subGridObj.getData();
					layui.YsModal.init({
						modalKey: 'TCC_LogisticsComprehensive_PayWl',
						type: 'checkbox',
						uniqueKey: 'logInvoiceNo',
						parentObj: t.c.subGridObj,
						selectedData: gridDatas,
						extraData:{},
						conditionsDefault: [],
					});
					break;
				}
				case 'event-to-delete': // 删除
				{
					t.c.subGridObj.removeRowsChecked();
					break;
				}
				case 'event-to-search': // 错误查询
				{
					var w = ($(window).width() * 0.9);
					var h = ($(window).height() - 50);
					var index = layer.open({
						type: 2, area: [w + 'px', h + 'px'],
						fix: true,
						maxmin: false,
						shadeClose: true,
						shade: 0.4,
						title: "错误查询",
						content: '/web/storage/tccLogisticsPaymentFee/errorSearch'
					});



					break;
				}
			};
		},




	};
	/* 定义object对象【end】 */
	
	
	exports('YsSubGridBtn', object);
});